import 'package:flutter/material.dart';

class SliderDemo extends StatefulWidget {
  const SliderDemo({super.key});

  @override
  State<SliderDemo> createState() => _SliderDemoState();
}

class _SliderDemoState extends State<SliderDemo> {
  double _sliderItemA = 0.0;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('SliderDemo'),
        elevation: 0,
      ),
      body: Container(
        padding: const EdgeInsets.all(10),
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Row(
              mainAxisAlignment: MainAxisAlignment.center,
              children: [
                Slider(
                  value: _sliderItemA,
                  onChanged: (value) {
                    setState(() {
                      _sliderItemA = value;
                    });
                  },
                  activeColor: Colors.amber,
                  inactiveColor: Colors.amber.withOpacity(0.2),
                  min: 0.0,
                  max: 100,
                  divisions: 10,
                  label: '$_sliderItemA',
                ),
              ],
            ),
            const SizedBox(height: 16,),
            Text('SliderValue ${_sliderItemA.toInt()}')
          ],
        ),
      ),
    );
  }
}